<?php
/**
 * Created by PhpStorm.
 * User: DELL
 * Date: 2017/10/9
 * Time: 16:33
 */
namespace Common\Model;
use Think\Model;
class GroupModel extends Model{
    protected $insertFields = array('name','desc','lang','type');
    protected $updateFields = array('name','desc','lang','type');
    public $_regist_validate = array(
        array('name', 'require', '用户名称不能为空！', 1),
    );
    public function getlst(){
        $where=array();
        $where['type']=array('EQ',1);
        $count = $this->alias('a')->where($where)->count();// 查询满足要求的总记录数
        $Page = new \Think\Page($count, 5);// 实例化分页类 传入总记录数和每页显示的记录数(25)
        $Page->setConfig('next', '下一页');
        $Page->setConfig('prev', '上一页');
        $show = $Page->show();// 分页显示输出// 进行分页数据查询 注意limit方法的参数要使用Page类的属性
        $list= $this->field('id,name,desc')->limit($Page->firstRow . ',' . $Page->listRows)->where($where)->select();
        return array(
            'list' => $list,
            'show' => $show
        );

    }



}